<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>&submitted=1" method="POST">
<input type="hidden" name="id" value="<?php echo $c->song->id; ?>"/>
<h3>Songs</h3>
<div id="searchshow">
<a href="#" onclick="javascript:toggleVisibility('search');">Show Search</a>
</div>
<div id="search" style="display:none;">
<a href="#" onclick="javascript:toggleVisibility('search');">Hide Search</a>
<input type="hidden" id="sort" name="sort" value="<?php echo $c->sort; ?>" />
<table id="data">
<tr><th>Title</td><td><input type="text" name="title" value="<?php echo $c->song->title; ?>" /></td></tr>
<tr><th>Author</td><td><input type="text" name="author" value="<?php echo $c->song->author; ?>" /></td></tr>
<tr><th>Key</td><td><?php echo dropdown("key_played", $c->song->key_played, "songkey"); ?></td></tr>
<tr><th>Active</td><td><input type="checkbox" name="active" value="T" <?php if ($c->song->active == "T") echo " checked"; ?>/></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" name="action" value="Search" /></td></tr>
</table>
<br/>
</div>
<br/>
<?php if (count($c->songs) > 0) { ?>
<table id="results">
<tr><th onclick="sortBy('title')">Title</th><th onclick="sortBy('author')">Author</th><th onclick="sortBy('key_played')">Key</th><th onclick="sortBy('active')">Active</th><th>Audio</th><th>Music/Lyrics</th></tr>
<?php
 foreach ($c->songs as $song)
 {
   ?><tr>
   		<td><?php echo HtmlUtil::internalLink("[edit]", "song", $userRoles, array("action" => "load", "id" => $song->id)); ?>
   			<?php echo HtmlUtil::internalLink($song->title, "viewSong", $userRoles, array("action" => "load", "id" => $song->id), $song->title); ?></td>
   		<td><?php echo $song->author; ?></td>
   		<td><?php echo CodeLookupUtil::getValue("songkey", $song->key_played); ?></td>
   		<td><?php echo ($song->active == "T") ? "Yes" : "No"; ?></td>
   		<td><?php echo (strlen($song->audio) > 0) ? HtmlUtil::internalLink("[download]", "audio", $userRoles, array("action" => "load", "id" => $song->id)) : "" ?></td>
   		<td><?php echo (strlen($song->info) > 0) ? HtmlUtil::internalLink("[music/lyrics]", "tab", $userRoles, array("action" => "load", "id" => $song->id)) : ""; ?></td>
   	 </tr>
   <?php
 }
?>
</table>
<?php } ?>
</form>